package main;

import "fmt"

func twoSum(nums []int, target int) []int {
    hashTable := map[int]int{};
    for size, value := range nums {
        if targetIndex, ok := hashTable[target - value]; ok {
            return []int{targetIndex, size};
        }
        hashTable[value] = size;
    }
    return nil
}

func main() {
    fmt.Println("TwoSum Go demo start");
    var numArray = []int{2, 7, 11, 15};
    var target int = 9;
    result := twoSum(numArray, target);
    fmt.Println("TwoSum Go result:", result[0], " ", result[1]);

}